package com.team.client_server;

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.Socket;

public abstract class Connect implements Runnable {
	protected Thread thd ;
	protected Socket socket ;
	protected PrintWriter out ;
	protected int id;
	protected int seq;


	public Connect (Socket socket_, int nbId) {
		socket = socket_ ;
		id = nbId;
		try{
			out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true );
		}//try

		catch (IOException a ) {
			System.out.println("erreur3") ;
			a.printStackTrace();
		}//catch IO
		
		
		thd = new Thread (this) ;
		thd.start();
	}//connect
 
	public Connect (Socket socket_) {
		socket = socket_ ;
		
		try{
			out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()), true );
		}//try

		catch (IOException a ) {
			System.out.println("erreur3") ;
			a.printStackTrace();
		}//catch IO
		thd = new Thread (this) ;
		thd.start();
	}
	
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public abstract void run();
 
}
